package com.hsxxherp.simplify.controller;

import com.hsxxherp.simplify.dao.sm.pojo.AccountEntity;
import com.hsxxherp.simplify.dao.sm.servicce.IAccountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 1
 */
@Tag(name = "首页",description = "首页内容展示")
@RestController
public class IndexController {

    private static final Logger log = LoggerFactory.getLogger(IndexController.class);
    private final IAccountService accountService;

    public IndexController(IAccountService accountService) {
        this.accountService = accountService;
    }


    @Operation(summary = "主页")
    @RequestMapping(value = "/",method = RequestMethod.GET)
    public Map<String,Object> index() {

        AccountEntity account = new AccountEntity();
        account.setEmail("hsxxherp");
        account.setUsername("hsxxherp");
        account.setPasswordHash("hsxxherp");

        log.debug("debug:{}",account);
        log.info("info:{}",account);
        Map<String,Object> result = new HashMap<>(16);
        result.put("code",200);
        result.put("data",accountService.createAccount(account));
       return result;
    }
}
